from django.contrib import admin
from .models import CrisisAssessment, CrisisIntervention, HelpResource


@admin.register(CrisisAssessment)
class CrisisAssessmentAdmin(admin.ModelAdmin):
    """危机评估管理"""
    list_display = ['id', 'user', 'risk_level', 'is_urgent', 'created_at']
    list_filter = ['risk_level', 'is_urgent', 'created_at']
    search_fields = ['user__username', 'intervention_recommended']
    date_hierarchy = 'created_at'
    ordering = ['-created_at']


@admin.register(CrisisIntervention)
class CrisisInterventionAdmin(admin.ModelAdmin):
    """危机干预管理"""
    list_display = ['id', 'user', 'intervention_type', 'status', 'follow_up_needed', 'follow_up_date', 'created_at']
    list_filter = ['status', 'follow_up_needed', 'created_at']
    search_fields = ['user__username', 'intervention_type', 'description']
    date_hierarchy = 'created_at'
    ordering = ['-created_at']


@admin.register(HelpResource)
class HelpResourceAdmin(admin.ModelAdmin):
    """帮助资源管理"""
    list_display = ['id', 'resource_name', 'resource_type', 'region', 'is_24_7', 'is_active', 'created_at']
    list_filter = ['resource_type', 'is_24_7', 'is_active', 'created_at']
    search_fields = ['resource_name', 'description', 'region']
    ordering = ['-created_at']
